//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public abstract class LineJoinProperties : IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            ReadXmlCore(context);
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            WriteXmlCore(context);
        }

        #endregion

        public static LineJoinProperties ReadJoin(ReadContext context)
        {
            switch (context.ReaderLocalName)
            {
                case "round":
                    return context.ReadElement<LineJoinRoundProperties>();
                case "bevel":
                    return context.ReadElement<LineJoinBevelProperties>();
                case "miter":
                    return context.ReadElement<LineJoinMiterProperties>();
                default:
                    return null;
            }
        }

        internal abstract void ReadXmlCore(ReadContext context);

        internal abstract void WriteXmlCore(WriteContext context);
    }
}